package com.onemile.app;

import com.onemile.entity.PubConst;
import com.onemile.entity.PubConst.Intent_Key;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;

public class UIGuide extends Activity
{

   @Override
   protected void onCreate(Bundle savedInstanceState)
   {
	  super.onCreate(savedInstanceState);
	  setContentView(R.layout.guide);

	  SharedPreferences sp = getSharedPreferences(PubConst.Setting.Setting, Activity.MODE_PRIVATE);
	  if (sp.getBoolean(PubConst.Setting.IsGuide, false))
	  {
		 Intent intent = new Intent();
		 intent.setClass(UIGuide.this, UIHome.class);
		 startActivity(intent);
		 finish();
	  }
	  ImageView img = (ImageView) findViewById(R.id.btnGuide_guide);
	  img.setOnClickListener(new View.OnClickListener()
	  {
		 @Override
		 public void onClick(View v)
		 {
			SharedPreferences.Editor editor = getSharedPreferences(PubConst.Setting.Setting, Activity.MODE_PRIVATE).edit();
			editor.putBoolean(PubConst.Setting.IsGuide, true);
			editor.commit();

			Intent intent = new Intent();
			intent.setClass(UIGuide.this, UIHome.class);
			startActivity(intent);
			finish();
		 }
	  });
   }

   @Override
   public boolean onKeyDown(int keyCode, KeyEvent event)
   {
	  if (keyCode == event.KEYCODE_BACK)
	  {
		 // Intent intent=new Intent();
		 // intent.setClass(UIGuide.this, UIHome.class);
		 // startActivity(intent);
		 // finish();
	  }
	  return true;
   }
}
